/**
 * @fileOverview drag hover anchor
 * @author huangtonger@aliyun.com
 */
const Page = require('../../base/');

Page.registerBehaviour('dragHoverAnchorHotspot', diagram => {
  const graph = diagram.getGraph();
  graph.behaviourOn('anchor:dragenter', ev => {
    if (diagram.getSignal('dragEdge')) {
      const anchor = ev.shape;
      diagram.setHotspotActived(anchor, true);
    }
  });
  graph.behaviourOn('anchor:dragleave', ev => {
    if (diagram.getSignal('dragEdge')) {
      const anchor = ev.shape;
      diagram.setHotspotActived(anchor, false);
    }
  });
});
